<extend name="template/base_index" />

<block name="area_header">

    <link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/select2.min.css" />
    <script type="text/javascript" src="__CDN__/select2/4.0.0/js/select2.min.js"></script>
    <script type="text/javascript" src="__CDN__/select2/4.0.0/js/i18n/zh-CN.js"></script>
    <style type="text/css">
        td{
            text-align: center;
        }
        td pre{
            HEIGHT: 160PX;
            width:480px;
        }
        .object-code{
            width:480px;
            display: block;
            margin:0 auto;
            word-wrap: break-word;
            text-align: left;
            overflow: scroll;
            overflow-x: hidden;
        }
        .bg-info-black{
            background: #3C1F4A;
        }
    </style>
</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}

            <div class="h4 text-center">个人物品申报单上报
                <notempty name="businessNo">
                    <span class="text-danger">重新上报该流水: ({$businessNo})</span>
                </notempty>
            </div>
            <form class="personal_form row" method="post">
                <input type="hidden" name="order_code" value="{$order.order_code}" />
                <input  type="hidden" name="businessNo" value="{$businessNo}" />


                <div class="form-group pull-left  col-lg-6 col-md-6">
                    <!--<label>订单编号</label>-->
                    <!--<div class=" ">{$order.order_code}</div>-->
                    <label>上报订单编号</label>
                    <div class=" ">{$order.pay_code}</div>
                </div>
                <div class="form-group pull-left  col-lg-6 col-md-6">
                    <label>申请单编号</label>
                    <div class="">
                        <input type="text" class="form-control input-normal" name="application_form_no" value="A33015600052015100000004" />
                       正式: A33015600052015100000004
                    </div>
                </div>

                <div class="form-group pull-left  col-lg-6 col-md-6">
                    <label>独立包装的物品总数，默认1,(一般是商品的数目+需要的包材数目)</label>
                    <div class=" ">
                        <input type="text" name="pack_no" value="{:($pack_no+1)}" />
                        包材:通常指包装
                    </div>
                </div>

                <div class="form-group pull-left  col-lg-6 col-md-6">
                    <label>进口类型</label>
                    <div class="">
                        <select name="importType" class="form-control input-normal">
                            <option value="1">保税进口</option>
                            <option value="0">直邮进口</option>
                        </select>
                    </div>
                </div>

                <div class="form-group pull-left  col-lg-6 col-md-6">
                    <label>申报单位类别</label>
                    <div class="">
                        <select name="declareCompanyType" class="form-control input-normal">
                            <option value="个人委托第三方申报">个人委托第三方申报</option>
                            <option value="个人委托电商企业申报">个人委托电商企业申报</option>
                            <option value="个人委托物流企业申报">个人委托物流企业申报</option>
                        </select>
                        <span class="help-block">斑马目前选委托第三方申报</span>
                    </div>
                </div>

                <div class="form-group  pull-left  col-lg-6 col-md-6">
                    <label>运输方式</label>
                    <div class=" ">
                        <select name="traf_mode" class="form-control input-normal">
                            <volist name="traf_mode_list" id="vo">
                                <option   <eq name="vo['code']" value="8">selected="selected"</eq>  value="{$vo.code}">{$vo.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>



                <div class="form-group  pull-left  col-lg-6 col-md-6">
                    <label>进出口岸</label>
                    <div class=" ">
                        <select name="ie_port" class="form-control input-normal">
                            <volist name="decl_port_list" id="vo">
                                <option  <eq name="vo['code']" value="2991">selected="selected"</eq>  value="{$vo.code}">{$vo.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>
                <div class="form-group  pull-left  col-lg-6 col-md-6">
                    <label>申报口岸</label>
                    <div class=" ">
                        <select name="decl_port" class="form-control input-normal">
                            <volist name="decl_port_list" id="vo">
                                <option <eq name="vo['code']" value="2991">selected="selected"</eq>  value="{$vo.code}">{$vo.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>
                <div class="form-group  pull-left  col-lg-6 col-md-6">
                    <label>贸易国别(起运地),不能为中国</label>
                    <div class=" ">
                        <select name="trade_country" class="form-control input-normal">
                            <volist name="country_list" id="vo">
                                <option  <eq name="vo['code']" value="110">selected="selected"</eq>  value="{$vo.code}">{$vo.name}</option>
                            </volist>
                        </select>
                    </div>

                </div>

                <div class="form-group  pull-left  col-lg-6 col-md-6">
                    <label>抵运港</label>
                    <div class=" ">
                        <select name="destination_port" class="form-control input-normal">
                            <volist name="port_of_shipment" id="vo">
                                <option <eq name="vo['code']" value="142">selected="selected"</eq>  value="{$vo.code}">{$vo.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>

                <div class="form-group  pull-left  col-lg-6 col-md-6">
                    <label>码头/货场</label>
                    <div class=" ">
                        <select name="customs_field" class="form-control input-normal">
                            <volist name="customs_field_list" id="vo">
                                <option  <eq name="vo['code']" value="299102">selected="selected"</eq>  value="{$vo.code}">{$vo.name}</option>
                            </volist>
                        </select>
                    </div>
                </div>

                <div class="text-center   pull-left  col-lg-12 col-md-12">
                    <a target-form="personal_form" href="{:U('Admin/Zjport/uploadPersonal')}" data-loading-text="正在上报中..."  class="ajax-post btn btn-sm btn-primary">个人物品申报单数据上报</a>
                    <a href="javascript:history.back(-1);" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
                </div>
                <div class="js_info text-center">

                </div>
            </form>

            <div class="bg-info padding-sm bg-info-black margin-top-sm" style="">
            <h4 class="text-center">电子口岸上报错误日志</h4>

            <div class="" style="padding: 10px">
                <empty name="callback_list" >
                    <div class="text-center">尚无纪录</div>
                    <else/>
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <td>序号</td>
                        <td>上报流水号</td>
                        <td>处理结果</td>
                        <td>处理时间</td>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="callback_list" id="vo">
                        <tr>
                            <td>{$key+1}</td>
                            <td ><span class="" title="{$vo.serial_no}">{$vo.serial_no}</span></td>
                            <td ><span class="" title="{$vo.upload_content}">{$vo.upload_content},{$vo['result']}</span></td>

                            <td>{:date("Y-m-d H:i:s",$vo['upload_time'])}</td>
                        </tr>
                    </volist>

                    </tbody>
                </table>
                </empty>
                <div>{$callback_show}</div>
            </div>

            </div>


            <h4>上报电子口岸纪录</h4>
            <div class="" style="padding: 10px">
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <td>序号</td>
                        <td>上报流水号</td>
                        <td>上报结果</td>
                        <td>上报时间</td>
                        <td>海关异步结果</td>
                        <td>海关异步处理时间</td>
                    </tr>
                    </thead>
                    <volist name="list" id="vo">
                        <tr>
                            <td>{$key+1}</td>
                            <td ><span class="" title="{$vo.serial_no}">{$vo.serial_no}</span><a href="{:U('Admin/Zjport/uploadPersonal',array('businessNo'=>$vo['serial_no'],'order_code'=>$order['order_code']))}">重新上报</a></td>
                            <td ><span class="" title="{$vo.upload_content}">{:getZjportPersonalResult($vo['result'])}</span></td>
                            <td>{:date("Y-m-d H:i:s",$vo['upload_time'])}</td>
                            <td>{$vo['asyn_result']}</td>
                            <td>
                                <if condition="$vo['aysn_catch_time'] gt 0">
                                    {:date("Y-m-d H:i:s",$vo['aysn_catch_time'])}
                                    <else/>
                                    没有接收到异步回执
                                </if>
                            </td>
                        </tr>
                    </volist>
                </table>
                <div>{$show}</div>
            </div>

        </div>

        <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
</block>

<block name="area_footer">

    <script type="text/javascript">

//        function upload(){
//            var order_code = "{$order.order_code}";
//            var item_count = "{$item_count}";
//
//            $.ajax({
//                url:"__SELF__",
//                data:{order_code:order_code,item_count:item_count},
//                type:"POST",
//                beforeSend:function(){
//                    $(".J_upload").button("loading");
//                }
//            }).always(function(){
//                $(".J_upload").button("reset");
//            }).done(function(data){
//                console.log(data);
//                if(data.status){
//                    var info = data.info;
//                    console.log("info=",info);
//                    if(info.code == 0){
//                        $(".js_info").text(info.data.stringOfResultDetail);
//                        $(".js_info").addClass("text-success");
//                    }
//                }else{
//                    $(".js_info").text(data.info);
//                    $.scojs_message(data.info , $.scojs_message.TYPE_ERROR);
//                }
//            }).fail(function(){
//                $.scojs_message("上报失败!请刷新后重试!", $.scojs_message.TYPE_ERROR);
//            });
//
//        }

        $(function(){

            $("select").select2();
//            $(".J_upload").click(function(){
//
//                upload();
//
//            });



        })


    </script>

</block>